babl-memory: allow babl_malloc(0) to succeed
authorEll <ell_se@yahoo.com>
Wed, 30 May 2018 09:45:17 +0000 (05:45 -0400)
committerEll <ell_se@yahoo.com>
Wed, 30 May 2018 09:45:17 +0000 (05:45 -0400)
Allow a babl_malloc() call with size == 0 to succeed, returning a
dummy allocation, instead of asserting on this condition.  The new
babl-palette code tries to allocate an empty buffer for the radii
array when creating a single-color palette, which would previously
lead to a crash.

babl/babl-memory.c

index d0229e4d4aba6ac73693e845da0db5539f7e1dc7..f4028402a9c4f8e40056ace4721b52915b7923fa 100644 (file)
@@ -111,8 +111,6 @@ babl_malloc (size_t size)
   char *ret;
   int  offset;
 
-  babl_assert (size);
-
   functions_sanity ();
   ret = malloc_f (BABL_ALLOC + BABL_ALIGN + size);
   if (!ret)